package com.bwie.controller;

import com.bwie.pojo.TbProdInfo;
import com.bwie.service.TbOrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: badaotianqiong
 * @Date: 2025/6/27 16:22
 * @Description:
 **/
@RestController
@RequestMapping("/shop/index")
public class OrderController {
    @Autowired
    private TbOrderService tbOrderService;

    @PostMapping("getOrderList")
    public R getOrderList(@RequestBody PageInfoVo pageInfoVo){
        return tbOrderService.getOrderList(pageInfoVo);
    }

    @PostMapping("getProdInfo")
    public R getProdInfo(){
        return tbOrderService.getProdInfo();
    }

    @PostMapping("/addOrder")
    public R addOrder(@RequestBody List<TbProdInfo> tbProdInfoList){
        return tbOrderService.addOrder(tbProdInfoList);
    }

    @GetMapping("/excelOrderList/{userId}")
    public void excelOrderList(@PathVariable("userId") Integer userId){
        tbOrderService.excelOrderList(userId);
    }

}
